#!/usr/bin/env python

a = '1'
for i in range(1, 31):
    b = ''
    j = 0
    while j < len(a):
        k = j + 1
        while k < len(a) and a[k] == a[j]:
            k += 1
        b += str(k - j)
        b += str(a[j])
        j = k
    a = b
    print a
print len(a)
